{
  "cells": [
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Ma_-6sDA-RaE"
      },
      "source": [
        "# AI‑Powered Personalized Learning Assistant with Smart Content Chatbot\n",
        "Powered by **praisonaiagents**, **OpenAI API**, and **Hugging Face Transformers**.\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "dSQ-cb--A7Ys"
      },
      "source": [
        "[![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/DhivyaBharathy-web/PraisonAI/blob/main/examples/cookbooks/personalized_learning_assistant.ipynb)\n"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "mu7qWPtq_eOd"
      },
      "source": [
        "# Dependencies"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "bPvUlNIV-RaK"
      },
      "outputs": [],
      "source": [
        "!pip install praisonaiagents openai transformers"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "Z_SH8eTwAf3v"
      },
      "source": [
        "# Tools Used"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "ffqa_kI_ApwO"
      },
      "source": [
        "✅ praisonaiagents – Builds the smart tutoring agent.\n",
        "\n",
        "✅ openai – Connects to OpenAI’s GPT for accurate responses.\n",
        "\n",
        "✅ Hugging Face transformers – Uses GPT-2 as a fallback if OpenAI isn’t available.\n",
        "\n",
        "✅Python I/O – Enables interactive chat using input() and print()."
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "fYU4lvNV_jyp"
      },
      "source": [
        "# Set Api Key"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "id": "gXlxt_gz-RaL"
      },
      "outputs": [],
      "source": [
        "import os\n",
        "os.environ['OPENAI_API_KEY'] = input('Enter your OpenAI API key: ')"
      ]
    },
    {
      "cell_type": "markdown",
      "metadata": {
        "id": "yh4uKOB4_xQl"
      },
      "source": [
        "# Main"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 258,
          "referenced_widgets": [
            "dc97b547b11b41c79f293032f84243a3",
            "ff4335dceb3d4b3b8d13a04f5c0bff73",
            "df648eb8626e40b5bc13ae58fff1b42e",
            "c0061c2cf09c4d8f9d0dcd735e464c5d",
            "bb1b511cc3b644bfa5ebcdc9fa3cc6b6",
            "e204a3e4fd65431985317aa51287b15f",
            "c884cfdd133e42fd8c8b54505b1494c6",
            "b533995c6724481486c1a753ca1a1966",
            "0b7c2014d0b3493c9b9d2325e0a846e1",
            "16ade62581ac412dac0924574366e977",
            "5e3ef88a547e418d9b5a26671c352fa6",
            "7b71a29acb1f44ca93c962114163fcff",
            "9723d0ca7c1f4abfb93bbbede0eb65d4",
            "95a1b145785c4fd881a58961afd385e5",
            "4a1acd18aad64a7a8d39bba617577ee4",
            "0c82f0b829f049ab91fa9a81970917c5",
            "c2f10a3ec48f41ad9c85941bdac0fdde",
            "c1fd448e3cad48bc82f309eabd25d5c5",
            "bb982458adec49608bf01c35ee6c36e5",
            "843019e709cd40eb9afef212857f5dcb",
            "c7d4261778a54645b1d3f793ddf25d19",
            "f01403e275fb4ac7b90e4fc25695caa4",
            "362e1762012341b180502fa68bb1d4c1",
            "637a253c8a1049ceb3cb45eb38d435ff",
            "3c583202d1ec4eac90387fad555c84c2",
            "bad0f052849843f3a9b7c250da3a6138",
            "8fdb3bee2379482fba84c8a8ee4b9950",
            "5b5dc04fdd094565a49fd5df77455e81",
            "806e3fc688704788a8350efae8175116",
            "50ab46cbe06a42c1b6f7f2cc63af3ec2",
            "47389688c19742f7b06f99ededd12890",
            "d87a6ec5eeb44b2782350f44c7a7eb05",
            "84f5fd3514e74389a333478bb9aa0f44",
            "b9c7aa568136493797109b873ebe3616",
            "ac18e246e59b4b2c82969d51c0f2298d",
            "67d92a37e63b43b288aa4bdd552d61e1",
            "0a033fe3fdf143dd804f04b9b97762d0",
            "75975646a23c4196843aecc651cff6f1",
            "e2458c89346541b29002f4fb92922488",
            "7ca831df46234cb1b120ed6710998c22",
            "eeadb7301f434e9fbcf0b38eb47336d7",
            "d5225c830bf7456297fb69439bd43b54",
            "03f44b7f997e4ef3a2b1054007ca4a4e",
            "c63ed8fc81c54d7b92ecbbce9fdc950b",
            "0808ee0189734b6ba992df2be9d4f15f",
            "70fca3c1206a4bf9b442d8bf2e4368b8",
            "e25e0dbf47e44d9cb22f309a83fe0707",
            "e2a0fcc56c114159b931887a673c8bfe",
            "a2d5263a5b6e4dd594d869e0a38c1fa1",
            "715bbacb30d54d50ba6328e77bdbcffb",
            "ecc05aff07b04b8fbce16dcea83008f8",
            "9e0b0e71547e42ae91ba4d8e027744f4",
            "1758ba511d564b9295cddf83f176d32b",
            "3c6601ed2b494d01910e4f30043ef95d",
            "de5a8ba940f742af8001f70c029b56b8",
            "ea77452dd7d0402991cfadc717a47d19",
            "a181f094d7184df5b747cafcdacb832a",
            "dbf86357b88f485d816528361c8f31c7",
            "6453702474fb4383889955a4ecda0168",
            "2c380d372b394252a5b13fd5c9a7f4e8",
            "0a92287900bf43e18df6d36ba17138cc",
            "2dfd301479704b2eaa0784effa5be92f",
            "301cd584eaa14333ab2e3c3b12181745",
            "50f0b5c832a34c7ebfc9e9d741184786",
            "7574fc34bcd14b059bb2d285fb147fe4",
            "91cccc1c2d39422bb323da0d6f2448b0",
            "db0c8ba302844fd5982c6ac996fbb868",
            "52e1b827d7c84ed3b217d43cc014c22c",
            "0187570a62f044eeb13426392ad173d9",
            "050c6f7089d841abae0c85f656715dad",
            "73d3092c22bb49a69984f190d002e2d0",
            "f5f9136e41fa45a684eca1feebb84f07",
            "9d9c38b4aa824b5ca456aff5bc469576",
            "7514acf98dc54826a1e305caac9ec4d9",
            "c8b83d6e35f4412d9990355105a0a65c",
            "a0dfc6c2761846168663e689ecfa8752",
            "d3687494bbd0465a99e7bb5fb62e36f8"
          ]
        },
        "id": "XshcuLCO-RaM",
        "outputId": "95d308ed-cb4a-402b-d755-afc8257afe34"
      },
      "outputs": [
        {
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "dc97b547b11b41c79f293032f84243a3",
              "version_major": 2,
              "version_minor": 0
            },
            "text/plain": [
              "config.json:   0%|          | 0.00/665 [00:00<?, ?B/s]"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "7b71a29acb1f44ca93c962114163fcff",
              "version_major": 2,
              "version_minor": 0
            },
            "text/plain": [
              "model.safetensors:   0%|          | 0.00/548M [00:00<?, ?B/s]"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "362e1762012341b180502fa68bb1d4c1",
              "version_major": 2,
              "version_minor": 0
            },
            "text/plain": [
              "generation_config.json:   0%|          | 0.00/124 [00:00<?, ?B/s]"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "b9c7aa568136493797109b873ebe3616",
              "version_major": 2,
              "version_minor": 0
            },
            "text/plain": [
              "tokenizer_config.json:   0%|          | 0.00/26.0 [00:00<?, ?B/s]"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "0808ee0189734b6ba992df2be9d4f15f",
              "version_major": 2,
              "version_minor": 0
            },
            "text/plain": [
              "vocab.json:   0%|          | 0.00/1.04M [00:00<?, ?B/s]"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "ea77452dd7d0402991cfadc717a47d19",
              "version_major": 2,
              "version_minor": 0
            },
            "text/plain": [
              "merges.txt:   0%|          | 0.00/456k [00:00<?, ?B/s]"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "db0c8ba302844fd5982c6ac996fbb868",
              "version_major": 2,
              "version_minor": 0
            },
            "text/plain": [
              "tokenizer.json:   0%|          | 0.00/1.36M [00:00<?, ?B/s]"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stderr",
          "output_type": "stream",
          "text": [
            "Device set to use cpu\n"
          ]
        }
      ],
      "source": [
        "from praisonaiagents import Agent\n",
        "from transformers import pipeline as hf_pipeline\n",
        "import openai\n",
        "\n",
        "openai.api_key = os.getenv('OPENAI_API_KEY')\n",
        "\n",
        "# Fallback NLP tool\n",
        "hf_chatbot = hf_pipeline('text-generation', model='gpt2')\n",
        "\n",
        "# Create smart Agent with praisonaiagents\n",
        "agent = Agent(instructions='You are a friendly tutor. Answer learner questions clearly and helpfully.')\n",
        "\n",
        "def chat_with_ai(user_input):\n",
        "    try:\n",
        "        return agent.start(user_input)\n",
        "    except Exception as e:\n",
        "        print('[Fallback GPT-2] ', e)\n",
        "        return hf_chatbot(user_input, max_length=100)[0]['generated_text']"
      ]
    },
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "colab": {
          "base_uri": "https://localhost:8080/",
          "height": 1000,
          "referenced_widgets": [
            "be1777343939486c941c1959f7632104",
            "1e3a02318cb642cb9304dece111a70cc",
            "7dca42e3bc724c6e9f63fd049a4539ea",
            "5b4ade0a459e42d38bc3cf84f01f6538"
          ]
        },
        "id": "vELE_tDT-RaN",
        "outputId": "8ac6cf86-7894-47a0-b47b-cbc1cb474b41"
      },
      "outputs": [
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "You: What is the Pythagorean theorem?\n"
          ]
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">╭─ </span><span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8; font-weight: bold\">Agent Info</span><span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\"> ────────────────────────────────────────────────────────────────────────────────────────────────────╮</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>                                                                                                                 <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>  <span style=\"color: #ff9b9b; text-decoration-color: #ff9b9b; font-weight: bold\">👤 Agent:</span> <span style=\"color: #ffe5e5; text-decoration-color: #ffe5e5\">Agent</span>                                                                                                <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>  <span style=\"color: #b4b4b3; text-decoration-color: #b4b4b3; font-weight: bold\">Role:</span> <span style=\"color: #ffe5e5; text-decoration-color: #ffe5e5\">Assistant</span>                                                                                                <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>                                                                                                                 <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[38;2;210;227;200m╭─\u001b[0m\u001b[38;2;210;227;200m \u001b[0m\u001b[1;38;2;210;227;200mAgent Info\u001b[0m\u001b[38;2;210;227;200m \u001b[0m\u001b[38;2;210;227;200m───────────────────────────────────────────────────────────────────────────────────────────────────\u001b[0m\u001b[38;2;210;227;200m─╮\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m                                                                                                                 \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m  \u001b[1;38;2;255;155;155m👤 Agent:\u001b[0m \u001b[38;2;255;229;229mAgent\u001b[0m                                                                                                \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m  \u001b[1;38;2;180;180;179mRole:\u001b[0m \u001b[38;2;255;229;229mAssistant\u001b[0m                                                                                                \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m                                                                                                                 \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "be1777343939486c941c1959f7632104",
              "version_major": 2,
              "version_minor": 0
            },
            "text/plain": [
              "Output()"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
            ],
            "text/plain": []
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">Response generated in 6.8s</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[2mResponse generated in 6.8s\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080\">╭───────────────────────────────────────────────────── Task ──────────────────────────────────────────────────────╮</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> What is the Pythagorean theorem?                                                                                <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[36m╭─\u001b[0m\u001b[36m────────────────────────────────────────────────────\u001b[0m\u001b[36m Task \u001b[0m\u001b[36m─────────────────────────────────────────────────────\u001b[0m\u001b[36m─╮\u001b[0m\n",
              "\u001b[36m│\u001b[0m What is the Pythagorean theorem?                                                                                \u001b[36m│\u001b[0m\n",
              "\u001b[36m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080\">╭─────────────────────────────────────────────────── Response ────────────────────────────────────────────────────╮</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> The Pythagorean theorem is a fundamental principle in geometry that relates to right-angled triangles. It       <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> states that in a right-angled triangle, the square of the length of the hypotenuse (the side opposite the right <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> angle) is equal to the sum of the squares of the lengths of the other two sides. This can be expressed with the <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> formula:                                                                                                        <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> [ a^2 + b^2 = c^2 ]                                                                                             <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> Here, ( c ) represents the length of the hypotenuse, while ( a ) and ( b ) represent the lengths of the other   <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> two sides. This theorem is useful for calculating the length of one side of a right triangle if the lengths of  <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> the other two sides are known.                                                                                  <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[36m╭─\u001b[0m\u001b[36m──────────────────────────────────────────────────\u001b[0m\u001b[36m Response \u001b[0m\u001b[36m───────────────────────────────────────────────────\u001b[0m\u001b[36m─╮\u001b[0m\n",
              "\u001b[36m│\u001b[0m The Pythagorean theorem is a fundamental principle in geometry that relates to right-angled triangles. It       \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m states that in a right-angled triangle, the square of the length of the hypotenuse (the side opposite the right \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m angle) is equal to the sum of the squares of the lengths of the other two sides. This can be expressed with the \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m formula:                                                                                                        \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m [ a^2 + b^2 = c^2 ]                                                                                             \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m Here, ( c ) represents the length of the hypotenuse, while ( a ) and ( b ) represent the lengths of the other   \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m two sides. This theorem is useful for calculating the length of one side of a right triangle if the lengths of  \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m the other two sides are known.                                                                                  \u001b[36m│\u001b[0m\n",
              "\u001b[36m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "🤖 Tutor: The Pythagorean theorem is a fundamental principle in geometry that relates to right-angled triangles. It states that in a right-angled triangle, the square of the length of the hypotenuse (the side opposite the right angle) is equal to the sum of the squares of the lengths of the other two sides. This can be expressed with the formula:\n",
            "\n",
            "\\[ a^2 + b^2 = c^2 \\]\n",
            "\n",
            "Here, \\( c \\) represents the length of the hypotenuse, while \\( a \\) and \\( b \\) represent the lengths of the other two sides. This theorem is useful for calculating the length of one side of a right triangle if the lengths of the other two sides are known.\n",
            "You: How does photosynthesis work?\n"
          ]
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">╭─ </span><span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8; font-weight: bold\">Agent Info</span><span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\"> ────────────────────────────────────────────────────────────────────────────────────────────────────╮</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>                                                                                                                 <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>  <span style=\"color: #ff9b9b; text-decoration-color: #ff9b9b; font-weight: bold\">👤 Agent:</span> <span style=\"color: #ffe5e5; text-decoration-color: #ffe5e5\">Agent</span>                                                                                                <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>  <span style=\"color: #b4b4b3; text-decoration-color: #b4b4b3; font-weight: bold\">Role:</span> <span style=\"color: #ffe5e5; text-decoration-color: #ffe5e5\">Assistant</span>                                                                                                <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>                                                                                                                 <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[38;2;210;227;200m╭─\u001b[0m\u001b[38;2;210;227;200m \u001b[0m\u001b[1;38;2;210;227;200mAgent Info\u001b[0m\u001b[38;2;210;227;200m \u001b[0m\u001b[38;2;210;227;200m───────────────────────────────────────────────────────────────────────────────────────────────────\u001b[0m\u001b[38;2;210;227;200m─╮\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m                                                                                                                 \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m  \u001b[1;38;2;255;155;155m👤 Agent:\u001b[0m \u001b[38;2;255;229;229mAgent\u001b[0m                                                                                                \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m  \u001b[1;38;2;180;180;179mRole:\u001b[0m \u001b[38;2;255;229;229mAssistant\u001b[0m                                                                                                \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m                                                                                                                 \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "application/vnd.jupyter.widget-view+json": {
              "model_id": "7dca42e3bc724c6e9f63fd049a4539ea",
              "version_major": 2,
              "version_minor": 0
            },
            "text/plain": [
              "Output()"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
            ],
            "text/plain": []
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">Response generated in 7.2s</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[2mResponse generated in 7.2s\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080\">╭───────────────────────────────────────────────────── Task ──────────────────────────────────────────────────────╮</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> How does photosynthesis work?                                                                                   <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[36m╭─\u001b[0m\u001b[36m────────────────────────────────────────────────────\u001b[0m\u001b[36m Task \u001b[0m\u001b[36m─────────────────────────────────────────────────────\u001b[0m\u001b[36m─╮\u001b[0m\n",
              "\u001b[36m│\u001b[0m How does photosynthesis work?                                                                                   \u001b[36m│\u001b[0m\n",
              "\u001b[36m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080\">╭─────────────────────────────────────────────────── Response ────────────────────────────────────────────────────╮</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> Photosynthesis is the process by which green plants, algae, and some bacteria convert light energy, usually     <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> from the sun, into chemical energy stored in glucose. This process is essential for life on Earth as it         <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> provides the oxygen we breathe and forms the base of the food chain. Here's how it works:                       <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> 1 </span><span style=\"font-weight: bold\">Light Absorption</span>: Photosynthesis begins when chlorophyll, the green pigment in plant cells, absorbs          <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">   </span>sunlight. This primarily occurs in the chloroplasts of plant cells.                                          <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> 2 </span><span style=\"font-weight: bold\">Water Splitting (Photolysis)</span>: The absorbed light energy is used to split water molecules (H₂O) into oxygen,  <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">   </span>protons, and electrons. This reaction releases oxygen as a byproduct, which is expelled into the atmosphere. <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> 3 </span><span style=\"font-weight: bold\">Energy Conversion (Light Reactions)</span>: The electrons and protons generated from water splitting are used in    <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">   </span>the light-dependent reactions. These reactions occur in the thylakoid membranes of the chloroplasts and      <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">   </span>result in the production of ATP (adenosine triphosphate) and NADPH, which are energy carriers.               <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> 4 </span><span style=\"font-weight: bold\">Carbon Fixation (Calvin Cycle)</span>: In the light-independent reactions, also known as the Calvin Cycle, ATP and  <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">   </span>NADPH produced in the light reactions are used to convert carbon dioxide (CO₂) from the atmosphere into      <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">   </span>glucose (C₆H₁₂O₆). This process occurs in the stroma of the chloroplasts.                                    <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\"> 5 </span><span style=\"font-weight: bold\">Glucose Formation</span>: The glucose produced can be used immediately by the plant for energy or can be converted  <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> <span style=\"color: #808000; text-decoration-color: #808000; font-weight: bold\">   </span>into other carbohydrates, such as starch, for storage.                                                       <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> Overall, the simplified equation for photosynthesis is:                                                         <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> [ 6CO₂ + 6H₂O + light \\ energy \\rightarrow C₆H₁₂O₆ + 6O₂ ]                                                      <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span>                                                                                                                 <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> This equation shows that carbon dioxide and water, in the presence of light energy, are transformed into        <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> glucose and oxygen.                                                                                             <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[36m╭─\u001b[0m\u001b[36m──────────────────────────────────────────────────\u001b[0m\u001b[36m Response \u001b[0m\u001b[36m───────────────────────────────────────────────────\u001b[0m\u001b[36m─╮\u001b[0m\n",
              "\u001b[36m│\u001b[0m Photosynthesis is the process by which green plants, algae, and some bacteria convert light energy, usually     \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m from the sun, into chemical energy stored in glucose. This process is essential for life on Earth as it         \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m provides the oxygen we breathe and forms the base of the food chain. Here's how it works:                       \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m 1 \u001b[0m\u001b[1mLight Absorption\u001b[0m: Photosynthesis begins when chlorophyll, the green pigment in plant cells, absorbs          \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0msunlight. This primarily occurs in the chloroplasts of plant cells.                                          \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m 2 \u001b[0m\u001b[1mWater Splitting (Photolysis)\u001b[0m: The absorbed light energy is used to split water molecules (H₂O) into oxygen,  \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0mprotons, and electrons. This reaction releases oxygen as a byproduct, which is expelled into the atmosphere. \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m 3 \u001b[0m\u001b[1mEnergy Conversion (Light Reactions)\u001b[0m: The electrons and protons generated from water splitting are used in    \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0mthe light-dependent reactions. These reactions occur in the thylakoid membranes of the chloroplasts and      \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0mresult in the production of ATP (adenosine triphosphate) and NADPH, which are energy carriers.               \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m 4 \u001b[0m\u001b[1mCarbon Fixation (Calvin Cycle)\u001b[0m: In the light-independent reactions, also known as the Calvin Cycle, ATP and  \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0mNADPH produced in the light reactions are used to convert carbon dioxide (CO₂) from the atmosphere into      \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0mglucose (C₆H₁₂O₆). This process occurs in the stroma of the chloroplasts.                                    \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m 5 \u001b[0m\u001b[1mGlucose Formation\u001b[0m: The glucose produced can be used immediately by the plant for energy or can be converted  \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m \u001b[1;33m   \u001b[0minto other carbohydrates, such as starch, for storage.                                                       \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m Overall, the simplified equation for photosynthesis is:                                                         \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m [ 6CO₂ + 6H₂O + light \\ energy \\rightarrow C₆H₁₂O₆ + 6O₂ ]                                                      \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m                                                                                                                 \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m This equation shows that carbon dioxide and water, in the presence of light energy, are transformed into        \u001b[36m│\u001b[0m\n",
              "\u001b[36m│\u001b[0m glucose and oxygen.                                                                                             \u001b[36m│\u001b[0m\n",
              "\u001b[36m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "🤖 Tutor: Photosynthesis is the process by which green plants, algae, and some bacteria convert light energy, usually from the sun, into chemical energy stored in glucose. This process is essential for life on Earth as it provides the oxygen we breathe and forms the base of the food chain. Here's how it works:\n",
            "\n",
            "1. **Light Absorption**: Photosynthesis begins when chlorophyll, the green pigment in plant cells, absorbs sunlight. This primarily occurs in the chloroplasts of plant cells.\n",
            "\n",
            "2. **Water Splitting (Photolysis)**: The absorbed light energy is used to split water molecules (H₂O) into oxygen, protons, and electrons. This reaction releases oxygen as a byproduct, which is expelled into the atmosphere.\n",
            "\n",
            "3. **Energy Conversion (Light Reactions)**: The electrons and protons generated from water splitting are used in the light-dependent reactions. These reactions occur in the thylakoid membranes of the chloroplasts and result in the production of ATP (adenosine triphosphate) and NADPH, which are energy carriers.\n",
            "\n",
            "4. **Carbon Fixation (Calvin Cycle)**: In the light-independent reactions, also known as the Calvin Cycle, ATP and NADPH produced in the light reactions are used to convert carbon dioxide (CO₂) from the atmosphere into glucose (C₆H₁₂O₆). This process occurs in the stroma of the chloroplasts.\n",
            "\n",
            "5. **Glucose Formation**: The glucose produced can be used immediately by the plant for energy or can be converted into other carbohydrates, such as starch, for storage.\n",
            "\n",
            "Overall, the simplified equation for photosynthesis is:\n",
            "\n",
            "\\[ 6CO₂ + 6H₂O + light \\ energy \\rightarrow C₆H₁₂O₆ + 6O₂ \\]\n",
            "\n",
            "This equation shows that carbon dioxide and water, in the presence of light energy, are transformed into glucose and oxygen.\n",
            "You: stop\n"
          ]
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">╭─ </span><span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8; font-weight: bold\">Agent Info</span><span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\"> ────────────────────────────────────────────────────────────────────────────────────────────────────╮</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>                                                                                                                 <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>  <span style=\"color: #ff9b9b; text-decoration-color: #ff9b9b; font-weight: bold\">👤 Agent:</span> <span style=\"color: #ffe5e5; text-decoration-color: #ffe5e5\">Agent</span>                                                                                                <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>  <span style=\"color: #b4b4b3; text-decoration-color: #b4b4b3; font-weight: bold\">Role:</span> <span style=\"color: #ffe5e5; text-decoration-color: #ffe5e5\">Assistant</span>                                                                                                <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>                                                                                                                 <span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">│</span>\n",
              "<span style=\"color: #d2e3c8; text-decoration-color: #d2e3c8\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[38;2;210;227;200m╭─\u001b[0m\u001b[38;2;210;227;200m \u001b[0m\u001b[1;38;2;210;227;200mAgent Info\u001b[0m\u001b[38;2;210;227;200m \u001b[0m\u001b[38;2;210;227;200m───────────────────────────────────────────────────────────────────────────────────────────────────\u001b[0m\u001b[38;2;210;227;200m─╮\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m                                                                                                                 \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m  \u001b[1;38;2;255;155;155m👤 Agent:\u001b[0m \u001b[38;2;255;229;229mAgent\u001b[0m                                                                                                \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m  \u001b[1;38;2;180;180;179mRole:\u001b[0m \u001b[38;2;255;229;229mAssistant\u001b[0m                                                                                                \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m│\u001b[0m                                                                                                                 \u001b[38;2;210;227;200m│\u001b[0m\n",
              "\u001b[38;2;210;227;200m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"></pre>\n"
            ],
            "text/plain": []
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\">\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #7f7f7f; text-decoration-color: #7f7f7f\">Response generated in 0.5s</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[2mResponse generated in 0.5s\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080\">╭───────────────────────────────────────────────────── Task ──────────────────────────────────────────────────────╮</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> stop                                                                                                            <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[36m╭─\u001b[0m\u001b[36m────────────────────────────────────────────────────\u001b[0m\u001b[36m Task \u001b[0m\u001b[36m─────────────────────────────────────────────────────\u001b[0m\u001b[36m─╮\u001b[0m\n",
              "\u001b[36m│\u001b[0m stop                                                                                                            \u001b[36m│\u001b[0m\n",
              "\u001b[36m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "data": {
            "text/html": [
              "<pre style=\"white-space:pre;overflow-x:auto;line-height:normal;font-family:Menlo,'DejaVu Sans Mono',consolas,'Courier New',monospace\"><span style=\"color: #008080; text-decoration-color: #008080\">╭─────────────────────────────────────────────────── Response ────────────────────────────────────────────────────╮</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">│</span> If you have any more questions or need further assistance, feel free to ask!                                    <span style=\"color: #008080; text-decoration-color: #008080\">│</span>\n",
              "<span style=\"color: #008080; text-decoration-color: #008080\">╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯</span>\n",
              "</pre>\n"
            ],
            "text/plain": [
              "\u001b[36m╭─\u001b[0m\u001b[36m──────────────────────────────────────────────────\u001b[0m\u001b[36m Response \u001b[0m\u001b[36m───────────────────────────────────────────────────\u001b[0m\u001b[36m─╮\u001b[0m\n",
              "\u001b[36m│\u001b[0m If you have any more questions or need further assistance, feel free to ask!                                    \u001b[36m│\u001b[0m\n",
              "\u001b[36m╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯\u001b[0m\n"
            ]
          },
          "metadata": {},
          "output_type": "display_data"
        },
        {
          "name": "stdout",
          "output_type": "stream",
          "text": [
            "🤖 Tutor: If you have any more questions or need further assistance, feel free to ask!\n",
            "You: exit\n",
            "Goodbye! Happy learning!\n"
          ]
        }
      ],
      "source": [
        "while True:\n",
        "    user_input = input('You: ')\n",
        "    if user_input.lower() in ['exit','quit']:\n",
        "        print('Goodbye! Happy learning!')\n",
        "        break\n",
        "    response = chat_with_ai(user_input)\n",
        "    print('🤖 Tutor:', response)"
      ]
    }
  ],
  "metadata": {
    "colab": {
      "provenance": []
    },
    "kernelspec": {
      "display_name": "Python 3",
      "name": "python3"
    },
    "language_info": {
      "name": "python"
    }
  },
  "nbformat": 4,
  "nbformat_minor": 0
}